package org.example.utils;

public class AjaxResult {
    private Boolean success = true;
    private String msg;
    private Object data;

    //下面这个方法，目的：是为简化赋值的操作
    public static AjaxResult success(String msg) {
        AjaxResult result = new AjaxResult();
        result.setSuccess(true);
        result.setMsg(msg);
        return result;
    }
    public static AjaxResult error(String msg) {
        AjaxResult result = new AjaxResult();
        result.setSuccess(false);
        result.setMsg(msg);
        return result;
    }

    public Boolean getSuccess() {
        return success;
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public AjaxResult setData(Object data) {
        this.data = data;
        return this;
    }
}
